java - get utc timestamp (in milliseconds)

Java
[Edit]
+
0
-
0

Java - get UTC timestamp (in milliseconds)

1 2 3 4 5 6 7 8 9 10 11 12 13
var timestamp = System.currentTimeMillis(); // in milliseconds System.out.println(timestamp); // e.g. 1716906171362 // Note: The method returns the current time in milliseconds. Note that while the unit of time of the return value // is a millisecond, the granularity of the value depends on the underlying operating system and may be larger. // For example, many operating systems measure time in units of tens of milliseconds. // References: // // 1. https://docs.oracle.com/javase/8/docs/api/java/lang/System.html#currentTimeMillis--